import axios from 'axios'
import { MD5 } from 'crypto-js'

const API_URL = '/api/submit';

export function submitEncryptedData(data) {
  const encryptedData = MD5(JSON.stringify(data)).toString();
  return axios.post(API_URL, { data: encryptedData });
}

submitEncryptedData({ userId: 123, userName: 'JhonDoe' })
  .then(response => {
    console.log('提交成功：', response.data);
  }).catch(error => {
    console.error('提交失败：', error);
  })